# Maintainer: Jelle van der Waa <jelle@archlinux.org>

pkgname=rebuilderd-website
pkgver=0.5.4
pkgrel=1
pkgdesc="Arch Linux Rebuilderd website reproducible.archlinux.org"
license=('MIT')
arch=(any)
depends=()
makedepends=('yarn' 'ruby-sass' 'make' 'git' 'svgcleaner')
url="https://gitlab.archlinux.org/archlinux/rebuilderd-website"
validpgpkeys=('E499C79F53C96A54E572FEE1C06086337C50773E')
source=("git+https://gitlab.archlinux.org/archlinux/rebuilderd-website.git#tag=v${pkgver}?signed"
        "git+https://gitlab.archlinux.org/archlinux/archlinux-common-style.git")
sha512sums=('SKIP'
            'SKIP')

build() {
  cd ${pkgname}
  make dist
}

package() {
  cd ${pkgname}
  install -d ${pkgdir}/usr/share/webapps/${pkgname}

  install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"

  # Install web files
  install -Dm644 dist/${pkgname}-${pkgver}/index.html "${pkgdir}/usr/share/webapps/${pkgname}/index.html"
  install -Dm644 dist/${pkgname}-${pkgver}/favicon.ico "${pkgdir}/usr/share/webapps/${pkgname}/favicon.ico"
  install -Dm644 dist/${pkgname}-${pkgver}/archlogo-${pkgver}.svg "${pkgdir}/usr/share/webapps/${pkgname}/archlogo-${pkgver}.svg"
  install -Dm644 dist/${pkgname}-${pkgver}/bundle-${pkgver}.css "${pkgdir}/usr/share/webapps/${pkgname}/bundle-${pkgver}.css"
  install -Dm644 dist/${pkgname}-${pkgver}/bundle-${pkgver}.js "${pkgdir}/usr/share/webapps/${pkgname}/bundle-${pkgver}.js"

  # TODO: Fix in Makefile
  install -d ${pkgdir}/usr/share/webapps/${pkgname}/icons
  install -Dm644 public/icons/note-16.svg "${pkgdir}/usr/share/webapps/${pkgname}/icons/note-16.svg"
  install -Dm644 public/icons/search-16.svg "${pkgdir}/usr/share/webapps/${pkgname}/icons/search-16.svg"
}
